<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/admin/common/inc/incSession.jsp" %>
<jsp:include page="/admin/common/inc/Top.jsp" />
<%

	String srchCond 	= util.getStr(request.getParameter("srchCond")); 
	String srchContent 	= util.getStr(request.getParameter("srchContent"));
	String srchStdt 	= util.getStr(request.getParameter("srchStdt"));
	String srchEndt 	= util.getStr(request.getParameter("srchEndt"));
	String srchUseYn 	= util.getStr(request.getParameter("srchUseYn"));
	
	
	// paging
	String perRow 		= util.getStr(request.getParameter("perRow"));
	String startRow 	= util.getStr(request.getParameter("startRow"));
	String currentPage 	= util.getStr(request.getParameter("currentPage"));
	
	String pointPerRow 		= util.getStr(request.getParameter("pointPerRow"));
	String pointStartRow 	= util.getStr(request.getParameter("pointStartRow"));
	String pointCurrentPage 	= util.getStr(request.getParameter("pointCurrentPage"));
	
	String reviewPerRow 		= util.getStr(request.getParameter("reviewPerRow"));
	String reviewStartRow 	= util.getStr(request.getParameter("reviewStartRow"));
	String reviewCurrentPage 	= util.getStr(request.getParameter("reviewCurrentPage"));
	
	String commPerRow 		= util.getStr(request.getParameter("commPerRow"));
	String commStartRow 	= util.getStr(request.getParameter("commStartRow"));
	String commCurrentPage 	= util.getStr(request.getParameter("commCurrentPage"));

	pointPerRow = "".equals(pointPerRow) ?"5":pointPerRow;
	pointStartRow = "".equals(pointStartRow)?"0":pointStartRow;
	pointCurrentPage = "".equals(pointCurrentPage)?"1":pointCurrentPage;
	
	reviewPerRow = "".equals(reviewPerRow) ?"5":reviewPerRow;
	reviewStartRow = "".equals(reviewStartRow)?"0":reviewStartRow;
	reviewCurrentPage = "".equals(reviewCurrentPage)?"1":reviewCurrentPage;
	
	commPerRow = "".equals(commPerRow) ?"5":commPerRow;
	commStartRow = "".equals(commStartRow)?"0":commStartRow;
	commCurrentPage = "".equals(commCurrentPage)?"1":commCurrentPage;

	String memberId 		= request.getParameter("memberId");


	param.put("memberId",memberId);
	
	//param.put("startRow",11);
	//param.put("perRow",10);
	
	HashMap map	 = 	(HashMap)sqlMap.queryForObject("AdminMember.selectMemberDetail",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
	
%>
<script type="text/javascript">
	// 리스트 갯수
	var dispCnt = '${dispCnt}';
	
	$(document).ready(function() {
		
		//	초기값 셋팅
		$("#srchCond").val("<%=srchCond%>");
		$("#srchContent").val("<%=srchContent%>");
		$("#srchStdt").val("<%=srchStdt%>");
		$("#srchEndt").val("<%=srchEndt%>");
		$("#srchUseYn").val("<%=srchUseYn%>");
		$("#memberId").val("<%=memberId%>");
		$("#startRow").val("<%=startRow%>");
		$("#currentPage").val("<%=currentPage%>");
		$("#pointStartRow").val("<%=pointStartRow%>");
		$("#pointCurrentPage").val("<%=pointCurrentPage%>");
		$("#reviewStartRow").val("<%=reviewStartRow%>");
		$("#reviewCurrentPage").val("<%=reviewCurrentPage%>");
		$("#commStartRow").val("<%=commStartRow%>");
		$("#commCurrentPage").val("<%=commCurrentPage%>");
		
		
		
		//	목록으로
		$("#btnList").click(function() {
			
			$("#listForm").attr("action","/admin/member/memberList.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		
		//	초기화
		$("#btnReset").click(function() {
			
			$("input[type=text]").val("");
			
		});
		
		//	검색
		jQuery("a[name^='goPage']").click(function(){
			
			$("#pointStartRow").val($(this).attr("startRow"));
			$("#pointCurrentPage").val($(this).attr("currentPage"));
			$("#listForm").attr("action","/admin/member/memberDetail.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		//	검색
		jQuery("a[name^='reviewPage']").click(function(){
			
			$("#reviewStartRow").val($(this).attr("startRow"));
			$("#reviewCurrentPage").val($(this).attr("currentPage"));
			$("#listForm").attr("action","/admin/member/memberDetail.jsp");
			$("#listForm").attr("target","_top");	
			
			$("#listForm").submit();
			
		});
		
		
		//	검색
		jQuery("a[name^='commPage']").click(function(){
			
			$("#commStartRow").val($(this).attr("startRow"));
			$("#commCurrentPage").val($(this).attr("currentPage"));
			$("#listForm").attr("action","/admin/member/memberDetail.jsp");
			$("#listForm").attr("target","_top");	
			
			$("#listForm").submit();
			
		});
		
	});
		
</script>	
	<body>
		<!-- header -->
		<div id="header">
			<jsp:include page="/admin/common/inc/Header.jsp" />
		</div>
		<!-- //header -->
		
		<!-- wrap -->
		<div id="wrap">
		
			<!-- contentWrap -->
			<div id="contentWrap">
			
				<!-- topmenu -->
				<jsp:include page="/admin/common/inc/TopMenu.jsp" />
				<!-- //topmenu -->
				
				
				<div id="conts">
				
					<div class="main_view clfix">
						<!-- content -->
						
						
						<div class="section_main" style="height: 730px;">
							
							<form id="listForm" name="listForm" method="post">
							<input type="hidden" name="srchCond" id="srchCond" value="" />
							<input type="hidden" name="srchContent" id="srchContent" value="" />
							<input type="hidden" name="srchStdt" id="srchStdt" value="" />
							<input type="hidden" name="srchEndt" id="srchEndt" value="" />
							<input type="hidden" name="srchUseYn" id="srchUseYn" value="" />
							<input type="hidden" name="memberId" id="memberId" value="" />
							
							<input type="hidden" name="pointStartRow" id="pointStartRow" value="" />
							<input type="hidden" name="pointCurrentPage" id="pointCurrentPage" value="" />
							
							<input type="hidden" name="reviewStartRow" id="reviewStartRow" value="" />
							<input type="hidden" name="reviewCurrentPage" id="reviewCurrentPage" value="" />
							
							<input type="hidden" name="commStartRow" id="commStartRow" value="" />
							<input type="hidden" name="commCurrentPage" id="commCurrentPage" value="" />
							
							<input type="hidden" name="startRow" id="startRow" value="" />
							<input type="hidden" name="currentPage" id="currentPage" value="" />
		
							<!--btn-->
							<%--
							<div class="al_right mt10">
								<button type="button" id="btnModify">수정</button>
								<button type="button" id="btnDelete">삭제</button>
							</div>
							--%>
							<!--//btn-->
						
							<!--board list-->
							<div class="board_list mt20">
								<h1>기본정보</h1>
							<% if (null!=map){
							%>
								<table style="table-layout:fixed" id="memberInfo" name="memberInfo">
									<tbody>
										<tr>
							                <td width="100" rowspan="2"><img src="<%=map.get("MEMBER_IMG") %>" onerror="this.src='/common/images/no_prof_img.jpg'" style="width: 100px; height: 100px;" /></td>
											<th width="50">성명</th>
											<td width="100"><%=map.get("MEMBER_NAME") %></td>
											<th width="50">이메일</th>
											<td width="100"><%=map.get("EMAIL") %></td>
							                <th width="50">닉네임</th>
											<td width="100"><%=map.get("NICKNAME") %></td>
							                <th width="50">가입일</th>
											<td width="100"><%=map.get("REG_DATE") %></td>
										</tr>
							            <tr>
							                <th width="50">비밀번호</th>
											<td width="100"><%=map.get("MEMBER_PW") %></td>
							                <th width="50">주소</th>
											<td width="100" colspan="3"><%=map.get("ADDR1") %>&nbsp;<%=map.get("ADDR2") %>&nbsp;<%=map.get("ZIPCODE") %></td>
							                <th width="50">연락처</th>
											<td width="100"><%=map.get("HP") %></td>
							            </tr>
									<%
										if( 0 >= map.size()){
									%>							            
						            	<tr class="nodata">
						                     <td align="center" colspan="8">조회된 Data 가 없습니다.</td>
						                </tr>
									<%
										}
									%>							            
									</tbody>
								</table>
								<%} %>
								
								<%
									param.clear();
									param.put("memberId",memberId);
									param.put("perRow", pointPerRow);
									param.put("startRow", pointStartRow);
									HashMap map1	 = 	(HashMap)sqlMap.queryForObject("AdminMember.selectMemberPointListTotal",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
									ArrayList rs =	(ArrayList)sqlMap.queryForList("AdminMember.selectMemberPointList",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
								%>
								<h1 class="mt20">Point</h1>
								<table style="table-layout:fixed" id="memberPoint" name="memberPoint">
									<thead>
										<tr>
											<th width="100">포인트 적립 사유</th>
							                <th width="100">적립 포인트</th>
							                <th width="100">포인트 적립일</th>
										</tr>
									</thead>
									<tbody id="prodList" name="prodList">
									<%
										if( 0 >= rs.size()){
									%>							            
						            	<tr class="nodata">
						                     <td align="center" colspan="3">조회된 Data 가 없습니다.</td>
						                </tr>
									<%
										}
									%>			
									<%
										for( int i = 0 ; i < rs.size() ; i++){
									%>
							            <tr>
											<td width="100"><%=util.getStr(((HashMap)rs.get(i)).get("POINT_CODE")) %></td>
											<td width="100"><%=util.getStr(((HashMap)rs.get(i)).get("POINT")) %></td>
											<td width="100"><%=util.getStr(((HashMap)rs.get(i)).get("POINT_DATE")) %></td>
							            </tr>
									<%
										}
									%>
									<%
										for( int i = 5 ; i > rs.size() ; i--){
									%>
							            <tr>
											<td width="100">&nbsp;</td>
							            </tr>
									<%
										}
									%>
									</tbody>
								</table>
								<!--//board list-->						
								<div class="section_main" style="height: 45px; width: 99.5%;">
									<%=util.paging(Integer.parseInt(map1.get("totCnt").toString()), Integer.parseInt(pointCurrentPage) , 5 ,request.getRequestURL().toString(),"goPage")%>
								</div>
								<h1 class="mt20">활동내역</h1>
								
								<%
									param.clear();
									param.put("memberId",memberId);
									param.put("perRow", reviewPerRow);
									param.put("startRow", reviewStartRow);
									HashMap map2	 = 	(HashMap)sqlMap.queryForObject("AdminMember.selectMemberReviewListTotal",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
									ArrayList rs1 =	(ArrayList)sqlMap.queryForList("AdminMember.selectMemberReviewList",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
								%>
								<div style="float: left;">
								<h3 class="mt10" style="display: inline; margin-right: 5px;">Review</h3><span>(<%=map2.get("totCnt") %>)</span>
								<table style="table-layout:fixed; width:470px;" id="memberReview" name="memberReview">
									<thead>
										<tr>
											<th width="100">이벤트 명</th>
							                <th width="100">url</th>
							                <th width="100">리뷰 작성일</th>
										</tr>
									</thead>
									<tbody id="prodList" name="prodList">
									<%
										if( 0 >= rs1.size()){
									%>							            
						            	<tr class="nodata">
						                     <td align="center" colspan="3">조회된 Data 가 없습니다.</td>
						                </tr>
									<%
										}
									%>		
									<%
										for( int i = 0 ; i < rs1.size() ; i++){
									%>
							            <tr>
											<td width="100"><%=util.getStr(((HashMap)rs1.get(i)).get("EVENT_NAME")) %></td>
											<td width="100"><%=util.getStr(((HashMap)rs1.get(i)).get("BLOG_URL")) %></td>
											<td width="100"><%=util.getStr(((HashMap)rs1.get(i)).get("REG_DATE")) %></td>
							            </tr>
									<%
										}
									%>
									<%
										for( int i = 5 ; i > rs1.size() ; i--){
									%>
							            <tr>
											<td width="100">&nbsp;</td>
							            </tr>
									<%
										}
									%>
									</tbody>
								</table>
								<!--//board list-->						
								<div class="section_main" style="height: 45px; width: 470px;">
									<%=util.paging(Integer.parseInt(map2.get("totCnt").toString()), Integer.parseInt(reviewCurrentPage) , 5 ,request.getRequestURL().toString(),"reviewPage")%>
								</div>
								</div>
								<%
									param.clear();
									param.put("memberId",memberId);
									param.put("perRow", commPerRow);
									param.put("startRow", commStartRow);
									HashMap map3	 = 	(HashMap)sqlMap.queryForObject("AdminMember.selectMemberReviewListTotal",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
									ArrayList rs2 =	(ArrayList)sqlMap.queryForList("AdminMember.selectMemberReviewList",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
								%>
								<div style="margin-left: 480px;">
								<h3 class="mt10" style="display: inline; margin-right: 5px;">Community</h3><span>(<%=map3.get("totCnt") %>)</span>
								<table style="table-layout:fixed; width: 470px;" id="memberComm" name="memberComm">
									<thead>
										<tr>
											<th width="100">이벤트 명</th>
							                <th width="100">url</th>
							                <th width="100">리뷰 작성일</th>
										</tr>
									</thead>
									<tbody id="prodList" name="prodList">
									<%
										if( 0 >= rs2.size()){
									%>							            
						            	<tr class="nodata">
						                     <td align="center" colspan="3">조회된 Data 가 없습니다.</td>
						                </tr>
									<%
										}
									%>							      
									<%
										for( int i = 0 ; i < rs2.size() ; i++){
									%>
							            <tr>
											<td width="100"><%=util.getStr(((HashMap)rs2.get(i)).get("EVENT_NAME")) %></td>
											<td width="100"><%=util.getStr(((HashMap)rs2.get(i)).get("BLOG_URL")) %></td>
											<td width="100"><%=util.getStr(((HashMap)rs2.get(i)).get("REG_DATE")) %></td>
							            </tr>
									<%
										}
									%>
									<%
										for( int i = 5 ; i > rs1.size() ; i--){
									%>
							            <tr>
											<td width="100">&nbsp;</td>
							            </tr>
									<%
										}
									%>
									</tbody>
								</table>
								<!--//board list-->						
								<div class="section_main" style="height: 45px; width: 470px;">
									<%=util.paging(Integer.parseInt(map3.get("totCnt").toString()), Integer.parseInt(commCurrentPage) , 5 ,request.getRequestURL().toString(),"commPage")%>
								</div>
								</div>
							</div>
							<!--//board list-->
							
							</form>
						
						</div>
						<!--btn-->
						<div class="al_right" style="margin-top: 100px;">
							<button type="button" id="btnList">목록으로</button>
						</div>
						<!--//btn-->
						
						<!-- //content -->
						
					</div>
					
				</div>
				
			</div>
			<!-- //contentWrap -->
			
		</div>
		
		<div id="footer" style="background: url('/layoutSample/footer.png') no-repeat; height: 150px;">
		</div>
		
		<!-- //wrap -->
		
		
	
	</body>
</html>